home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 June: Reference Library / Dev.CD Jun 96 RL / Dev.CD Jun 96 RL.toast / Technical Documentation / develop / develop Issue 6 / develop Issue 6 code / TCP.sea / TCP / finger / CvtAddr.c < prev    next >
MacBinary  |  1991-04-03  |  1.8 KB  |  [TEXT/MPS ]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
1% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Wed Apr 3 17:29:09 1991, modified Wed Apr 3 17:29:09 1991, creator 'MPS ', type ASCII, 1182 bytes "CvtAddr.c" , at 0x51e 382 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% dearkID deark: macbinary default
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[MPS ]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 09 43 76 74 41 64 64 | 72 2e 63 00 00 00 00 00 |..CvtAdd|r.c.....|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 53 | 20 01 00 00 00 00 00 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 00 04 9e 00 | 00 01 7e a4 20 07 b5 a4 |........|..~. ...|
|00000060| 20 07 b5 00 00 00 00 00 | 00 00 00 00 00 00 00 00 | .......|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 07 c0 00 00 |........|........|
|00000080| 23 69 6e 63 6c 75 64 65 | 20 3c 54 79 70 65 73 2e |#include| <Types.|
|00000090| 68 3e 0d 23 69 6e 63 6c | 75 64 65 20 3c 4d 61 63 |h>.#incl|ude <Mac|
|000000a0| 54 43 50 43 6f 6d 6d 6f | 6e 54 79 70 65 73 2e 68 |TCPCommo|nTypes.h|
|000000b0| 3e 0d 23 69 6e 63 6c 75 | 64 65 20 3c 41 64 64 72 |>.#inclu|de <Addr|
|000000c0| 65 73 73 58 4c 61 74 69 | 6f 6e 2e 68 3e 0d 23 69 |essXLati|on.h>.#i|
|000000d0| 6e 63 6c 75 64 65 20 22 | 43 76 74 41 64 64 72 2e |nclude "|CvtAddr.|
|000000e0| 68 22 0d 0d 70 61 73 63 | 61 6c 20 76 6f 69 64 20 |h"..pasc|al void |
|000000f0| 44 4e 52 52 65 73 75 6c | 74 50 72 6f 63 28 73 74 |DNRResul|tProc(st|
|00000100| 72 75 63 74 20 68 6f 73 | 74 49 6e 66 6f 20 2a 68 |ruct hos|tInfo *h|
|00000110| 49 6e 66 6f 50 74 72 2c | 63 68 61 72 20 2a 75 73 |InfoPtr,|char *us|
|00000120| 65 72 44 61 74 61 50 74 | 72 29 3b 0d 0d 2f 2a 09 |erDataPt|r);../*.|
|00000130| 43 6f 6e 76 65 72 74 53 | 74 72 69 6e 67 54 6f 41 |ConvertS|tringToA|
|00000140| 64 64 72 20 69 73 20 61 | 20 73 69 6d 70 6c 65 20 |ddr is a| simple |
|00000150| 63 61 6c 6c 20 74 6f 20 | 67 65 74 20 61 20 68 6f |call to |get a ho|
|00000160| 73 74 27 73 20 49 50 20 | 6e 75 6d 62 65 72 2c 20 |st's IP |number, |
|00000170| 67 69 76 65 6e 20 74 68 | 65 20 6e 61 6d 65 0d 09 |given th|e name..|
|00000180| 6f 66 20 74 68 65 20 68 | 6f 73 74 2e 0d 2a 2f 0d |of the h|ost..*/.|
|00000190| 0d 4f 53 45 72 72 20 43 | 6f 6e 76 65 72 74 53 74 |.OSErr C|onvertSt|
|000001a0| 72 69 6e 67 54 6f 41 64 | 64 72 28 63 68 61 72 20 |ringToAd|dr(char |
|000001b0| 2a 6e 61 6d 65 2c 75 6e | 73 69 67 6e 65 64 20 6c |*name,un|signed l|
|000001c0| 6f 6e 67 20 2a 6e 65 74 | 4e 75 6d 29 0d 7b 0d 09 |ong *net|Num).{..|
|000001d0| 73 74 72 75 63 74 20 68 | 6f 73 74 49 6e 66 6f 20 |struct h|ostInfo |
|000001e0| 68 49 6e 66 6f 3b 0d 09 | 4f 53 45 72 72 20 72 65 |hInfo;..|OSErr re|
|000001f0| 73 75 6c 74 3b 0d 09 63 | 68 61 72 20 64 6f 6e 65 |sult;..c|har done|
|00000200| 20 3d 20 30 78 30 30 3b | 0d 09 65 78 74 65 72 6e | = 0x00;|..extern|
|00000210| 20 42 6f 6f 6c 65 61 6e | 20 67 43 61 6e 63 65 6c | Boolean| gCancel|
|00000220| 3b 0d 0d 09 69 66 20 28 | 28 72 65 73 75 6c 74 20 |;...if (|(result |
|00000230| 3d 20 4f 70 65 6e 52 65 | 73 6f 6c 76 65 72 28 6e |= OpenRe|solver(n|
|00000240| 69 6c 29 29 20 3d 3d 20 | 6e 6f 45 72 72 29 20 7b |il)) == |noErr) {|
|00000250| 0d 09 09 72 65 73 75 6c | 74 20 3d 20 53 74 72 54 |...resul|t = StrT|
|00000260| 6f 41 64 64 72 28 6e 61 | 6d 65 2c 26 68 49 6e 66 |oAddr(na|me,&hInf|
|00000270| 6f 2c 44 4e 52 52 65 73 | 75 6c 74 50 72 6f 63 2c |o,DNRRes|ultProc,|
|00000280| 26 64 6f 6e 65 29 3b 0d | 09 09 69 66 20 28 72 65 |&done);.|..if (re|
|00000290| 73 75 6c 74 20 3d 3d 20 | 63 61 63 68 65 46 61 75 |sult == |cacheFau|
|000002a0| 6c 74 29 0d 09 09 09 77 | 68 69 6c 65 20 28 21 64 |lt)....w|hile (!d|
|000002b0| 6f 6e 65 29 0d 09 09 09 | 09 3b 20 2f 2a 20 77 61 |one)....|.; /* wa|
|000002c0| 69 74 20 66 6f 72 20 63 | 61 63 68 65 20 66 61 75 |it for c|ache fau|
|000002d0| 6c 74 20 72 65 73 6f 6c | 76 65 72 20 74 6f 20 62 |lt resol|ver to b|
|000002e0| 65 20 63 61 6c 6c 65 64 | 20 62 79 20 69 6e 74 65 |e called| by inte|
|000002f0| 72 72 75 70 74 20 2a 2f | 0d 09 09 43 6c 6f 73 65 |rrupt */|...Close|
|00000300| 52 65 73 6f 6c 76 65 72 | 28 29 3b 0d 09 09 69 66 |Resolver|();...if|
|00000310| 20 28 28 68 49 6e 66 6f | 2e 72 74 6e 43 6f 64 65 | ((hInfo|.rtnCode|
|00000320| 20 3d 3d 20 6e 6f 45 72 | 72 29 20 7c 7c 20 28 68 | == noEr|r) || (h|
|00000330| 49 6e 66 6f 2e 72 74 6e | 43 6f 64 65 20 3d 3d 20 |Info.rtn|Code == |
|00000340| 63 61 63 68 65 46 61 75 | 6c 74 29 29 20 7b 0d 09 |cacheFau|lt)) {..|
|00000350| 09 09 2a 6e 65 74 4e 75 | 6d 20 3d 20 68 49 6e 66 |..*netNu|m = hInf|
|00000360| 6f 2e 61 64 64 72 5b 30 | 5d 3b 0d 09 09 09 73 74 |o.addr[0|];....st|
|00000370| 72 63 70 79 28 6e 61 6d | 65 2c 68 49 6e 66 6f 2e |rcpy(nam|e,hInfo.|
|00000380| 63 6e 61 6d 65 29 3b 0d | 09 09 09 6e 61 6d 65 5b |cname);.|...name[|
|00000390| 73 74 72 6c 65 6e 28 6e | 61 6d 65 29 2d 31 5d 20 |strlen(n|ame)-1] |
|000003a0| 3d 20 27 5c 30 27 3b 0d | 09 09 09 72 65 74 75 72 |= '\0';.|...retur|
|000003b0| 6e 20 6e 6f 45 72 72 3b | 0d 09 09 7d 0d 09 7d 0d |n noErr;|...}..}.|
|000003c0| 09 2a 6e 65 74 4e 75 6d | 20 3d 20 30 3b 0d 0d 09 |.*netNum| = 0;...|
|000003d0| 72 65 74 75 72 6e 20 72 | 65 73 75 6c 74 3b 0d 7d |return r|esult;.}|
|000003e0| 0d 0d 0d 2f 2a 09 54 68 | 69 73 20 69 73 20 74 68 |.../*.Th|is is th|
|000003f0| 65 20 63 6f 6d 70 6c 65 | 74 69 6f 6e 20 72 6f 75 |e comple|tion rou|
|00000400| 74 69 6e 65 20 75 73 65 | 64 20 66 6f 72 20 6e 61 |tine use|d for na|
|00000410| 6d 65 2d 72 65 73 6f 6c | 76 65 72 20 63 61 6c 6c |me-resol|ver call|
|00000420| 73 2e 0d 09 49 74 20 73 | 65 74 73 20 74 68 65 20 |s...It s|ets the |
|00000430| 75 73 65 72 44 61 74 61 | 50 74 72 20 66 6c 61 67 |userData|Ptr flag|
|00000440| 20 74 6f 20 69 6e 64 69 | 63 61 74 65 20 74 68 65 | to indi|cate the|
|00000450| 20 63 61 6c 6c 20 68 61 | 73 20 63 6f 6d 70 6c 65 | call ha|s comple|
|00000460| 74 65 64 2e 0d 2a 2f 0d | 0d 70 61 73 63 61 6c 20 |ted..*/.|.pascal |
|00000470| 76 6f 69 64 20 44 4e 52 | 52 65 73 75 6c 74 50 72 |void DNR|ResultPr|
|00000480| 6f 63 28 73 74 72 75 63 | 74 20 68 6f 73 74 49 6e |oc(struc|t hostIn|
|00000490| 66 6f 20 2a 68 49 6e 66 | 6f 50 74 72 2c 63 68 61 |fo *hInf|oPtr,cha|
|000004a0| 72 20 2a 75 73 65 72 44 | 61 74 61 50 74 72 29 0d |r *userD|ataPtr).|
|000004b0| 7b 0d 23 70 72 61 67 6d | 61 20 75 6e 75 73 65 64 |{.#pragm|a unused|
|000004c0| 20 28 68 49 6e 66 6f 50 | 74 72 29 0d 0d 09 2a 75 | (hInfoP|tr)...*u|
|000004d0| 73 65 72 44 61 74 61 50 | 74 72 20 3d 20 30 78 66 |serDataP|tr = 0xf|
|000004e0| 66 3b 09 2f 2a 20 73 65 | 74 74 69 6e 67 20 74 68 |f;./* se|tting th|
|000004f0| 65 20 75 73 65 20 64 61 | 74 61 20 74 6f 20 6e 6f |e use da|ta to no|
|00000500| 6e 2d 7a 65 72 6f 20 6d | 65 61 6e 73 20 77 65 27 |n-zero m|eans we'|
|00000510| 72 65 20 64 6f 6e 65 20 | 2a 2f 0d 7d 0d 0d 00 00 |re done |*/.}....|
|00000520| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000530| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000540| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000550| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000560| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000570| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000580| 00 00 01 00 00 00 01 4c | 00 00 00 4c 00 00 00 32 |.......L|...L...2|
|00000590| 65 61 74 65 20 74 68 65 | 20 42 75 69 6c 64 20 6d |eate the| Build m|
|000005a0| 65 6e 75 0d 23 0d 23 09 | 55 73 61 67 65 3a 0d 23 |enu.#.#.|Usage:.#|
|000005b0| 09 43 76 74 41 64 64 72 | 2e 63 02 00 00 00 54 45 |.CvtAddr|.c....TE|
|000005c0| 58 54 4d 50 53 20 01 00 | 00 00 00 c0 00 00 00 00 |XTMPS ..|........|
|000005d0| 00 00 54 45 58 54 4d 50 | 53 20 01 00 00 00 00 c0 |..TEXTMP|S ......|
|000005e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005f0| 00 00 a3 31 5a aa 00 00 | 04 9e 00 00 01 7e 74 65 |...1Z...|.....~te|
|00000600| 20 42 75 69 6c 64 20 43 | 6f 6d 6d 61 6e 64 73 c9 | Build C|ommands.|
|00000610| 0d 23 09 09 20 20 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |.#.. --|--------|
|00000620| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 0d |--------|-------.|
|00000630| 23 09 09 20 20 42 75 69 | 6c 64 c9 20 09 09 09 09 |#.. Bui|ld. ....|
|00000640| 09 20 23 42 0d 23 09 09 | 20 20 46 75 6c 6c 20 42 |. #B.#..| Full B|
|00000650| 75 69 6c 64 c9 0d 23 09 | 09 20 20 53 68 6f 77 20 |uild..#.|. Show |
|00000660| 42 75 69 6c 64 20 43 6f | 6d 6d 61 6e 64 73 c9 0d |Build Co|mmands..|
|00000670| 23 09 09 20 20 53 68 6f | 77 20 46 75 6c 6c 20 42 |#.. Sho|w Full B|
|00000680| 00 00 00 48 00 09 4d 6f | 6e 61 63 6f 00 00 0d 48 |...H..Mo|naco...H|
|00000690| 00 00 0d 64 00 00 0d 81 | 00 00 0d a1 00 00 0d b2 |...d....|........|
|000006a0| 00 00 0d b6 00 00 00 06 | 00 04 00 48 00 39 01 c1 |........|...H.9..|
|000006b0| 02 5a 00 48 00 39 01 c1 | 02 5a a3 ef 11 b0 00 00 |.Z.H.9..|.Z......|
|000006c0| 01 89 00 00 01 89 00 00 | 00 00 01 00 00 00 01 00 |........|........|
|000006d0| 00 00 01 4c 00 00 00 4c | 00 00 00 32 00 15 20 bc |...L...L|...2.. .|
|000006e0| 08 d2 00 00 00 1c 00 32 | 00 00 4d 50 53 52 00 00 |.......2|..MPSR..|
|000006f0| 00 0a 03 ed ff ff 00 00 | 00 00 00 16 c7 4c 00 00 |........|.....L..|
+--------+-------------------------+-------------------------+--------+--------+